package com.atguigu.day17.work;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Scanner;

public class Work002 {
    public static void main(String[] args) {
        Collection<Student1> list=new ArrayList<>();
        Scanner input=new Scanner(System.in);
        while (true){
            System.out.println("选择(1.录入:0.退出):");
            int select=input.nextInt();
            if (select==0){
                break;
            }
            System.out.print("姓名: ");
            String name=input.next();
            System.out.print("年龄: ");
            int age =input.nextInt();
            Student1 stu=new Student1(name,age);
            list.add(stu);
        }
        for (Student1 stu : list) {
            System.out.println(stu);
        }
    }
}
